<%@ include file="/common/taglibs.jsp"%>

<head>
    <title><fmt:message key="laundryRequestReception.title"/></title>
    <meta name="heading" content="<fmt:message key='laundryRequestReception.heading'/>"/>
    <meta name="menu" content="RoleAdminLaundry"/>   
</head>
<div id="help">
    <h2>
        <a href="<c:url value='helpLaundryRequestForm.html?decorate=false'/>"
           title="Help laundry request form"
           onclick="Modalbox.show(this.href, {title: this.title, width: 600}); return false;">
            <fmt:message key="help"/>
        </a>
    </h2>
</div>
<table class="tableGrey" id="SelectedDatas">
    <thead>
        <tr>
            <th class="hidden"/>
            <th><fmt:message key="laundry"/></th>
            <th><fmt:message key="pantDesign" /> </th>
            <th><fmt:message key="laundryType.type" /> </th>
            <th class="hidden"/>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td> <s:property value="laundryRequest.laundry.name" /> </td>
            
            <td> <s:property value="pantDesign.datasModelAndMaterial" /> </td>
            <td> <s:property value="laundryRequestItem.laundryType.type" /> </td>
            
        </tr>
    </tbody>
</table>
<s:form id="laundryRequestReceptionForm" name="laundryRequestReceptionForm" action="saveLaundryRequestReception" method="post" validate="true">
    <s:hidden key="laundryRequestItem.id" cssClass="text medium"/>
    <s:hidden name="quantitieIndexs" value="%{quantitieIndexs}"/>
    <%--s:hidden key="quantitiesCurrent" cssClass="text medium"/--%>

    <%--s:textfield key="laundryRequestItem.failUnitPrice" required="true" cssClass="text medium"/--%>
    <table class="table">
        <thead>
            <tr><th></th>
                <s:iterator value="modelSizes">
                    <th><s:property value="valueSize" /></th>
                </s:iterator>
            </tr>
        </thead>
        <tbody>
            <tr><td>Valores actuales:</td>
                <s:iterator value="quantitiesCurrent" id="quantitiesCurr" status="status">
                    <td><s:property value="%{quantitiesCurrent[#status.index]}"/>
                    </td>
                </s:iterator>
            </tr>
            <tr><td>Precio prenda:</td>
                <s:iterator value="quantitiesPriceCurrent" id="quantitiesPriCurr" status="status">
                    <c:if test="${quantitiesCurrent[status.index] != '0'}">
                        <td><s:textfield name="quantitiesPriceCurrent" value="%{quantitiesPriceCurrent[#status.index]}"  size="3"></s:textfield></td>
                    </c:if>
                    <c:if test="${quantitiesCurrent[status.index] == '0'}">
                        <td><s:property value="%{quantitiesPriceCurrent[#status.index]}"/></td>
                    </c:if>
                    
                </s:iterator>
            </tr>
            <tr><td>Cant. fallas:</td>
                <s:iterator value="quantitiesFail" id="quantitiesFail" status="status">
                    <c:if test="${quantitiesCurrent[status.index] != '0'}">
                        <td><s:textfield name="quantitiesFail" value="%{quantitiesFail[#status.index]}"  size="3"></s:textfield></td>
                    </c:if>
                    <c:if test="${quantitiesCurrent[status.index] == '0'}">
                        <td><s:property value="%{quantitiesFail[#status.index]}"/></td>
                    </c:if>
                    
                </s:iterator>
            </tr>
            <tr><td>Precio x falla:</td>
                <s:iterator value="quantitiesPriceFail" id="quantitiesPriceFail" status="status">
                    <c:if test="${quantitiesCurrent[status.index] != '0'}">
                        <td><s:textfield name="quantitiesPriceFail" value="%{quantitiesPriceFail[#status.index]}"  size="3"></s:textfield></td>
                    </c:if>
                    <c:if test="${quantitiesCurrent[status.index] == '0'}">
                        <td><s:property value="%{quantitiesPriceFail[#status.index]}"/></td>
                    </c:if>
                </s:iterator>
            </tr>
        </tbody>
    </table>

    <li class="buttonBar bottom">
        <s:submit cssClass="button" method="save" key="button.save" theme="simple"/>
        <c:if test="${not empty laundryRequestItem.id}">
            <s:submit cssClass="button" method="delete" key="button.delete" onclick="return confirmDelete('loundryRequest')" theme="simple"/>
        </c:if>
        <s:submit cssClass="button" method="cancel" key="button.cancel"  theme="simple"/>
    </li>
</s:form>

<script type="text/javascript">
    Form.focusFirstElement($("laundryRequestReceptionForm"));
</script>